package com.sl.core.engine.datasource;

import com.google.common.collect.Maps;
import org.anyline.data.datasource.ApplicationConnectionHolder;

import java.sql.Connection;
import java.util.Map;

public class ProcessConnectionHolder extends ApplicationConnectionHolder {
    private static final Map<String, Connection> connections = Maps.newConcurrentMap();

    public static void set(String name, Connection con) {
        connections.put(name, con);
    }

    public static Connection get(String name) {
        return connections.get(name);
    }

    public static void remove(String name) {
         connections.remove(name);
    }

    public static boolean contains(String name) {
        if(connections.containsKey(name)) {
            return true;
        }
        return false;
    }
}
